<extend name="layout/main" />

<block name="HEADER">
	<style type="text/css">
		.xw__grid .layui-table-view .layui-table td .layui-table-cell{
			height: 50px;
		    line-height: 50px;
		}
		.file-img {
		    height: 100%;
		    background-position: left;
		    background-size: 100% 85%;
		    background-repeat: no-repeat;
		    cursor: pointer;
		}
		#detailedInfoForm .xw-form-formType-div{
			padding: 0 !important;
			padding-left: 5px !important;
		}
		#detailedInfoForm .sections:last-child .table-cell:last-child{ margin-bottom: 0; }
	</style>
</block>

<block name="CONTENT">
	<control:grid id="grid"/>
</block>


<block name="FOOTER">
	<script type="text/javascript">
		var page = (function(ns){
     		
     		var detailedInfoForm = null;
			
			//名称模板
		    ns.gridNameTemplet= function(e){
		    	var val = e.value;
		    	var str = 
		    		"<div  style='line-height:24px;' onclick='page.openGoods()'>"
			    		+ "<p class='link' style='overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='"+val+"'>"
			    			+val
			    		+"</p>"
			    		+ "<p style='font-size: 13px;color:#e24444;'>￥"+ $.toDecimal(Number(e.data.goods_sale_price)) +
			    			(function(){
			    				var s = '';
					    			s="<span style='text-decoration:line-through;color: #a7a7a7;margin-left:10px;'>￥"
					    				+$.toDecimal(Number(e.data.goods_oid_price))
					    			+"</span>";
			    				return s;
			    			}())
			    		+ "</p>";
		    		+"</div>";
		    	return str;
		    }
			
			//订单时间模板
			ns.gridTimeTemplet = function(e) {
				return "<div style='line-height:24px;white-space: normal;'>" + e.data.create_time + "</div>";
			}

			//地址模板
			ns.gridAddressTemplet = function(e) {
				var str =
					"<div style='line-height:24px;'>" +
					"<p>" + e.data.user_name + "&nbsp;&nbsp;" + e.data.user_phone + "</p>" +
					"<p>" + e.data.user_address+ "</p>" +
					"</div>";
				return str;
			}
     		
     		
		    //订单详情
			ns.edit = function() {
				var selectedRow = grid.getSelectedRows()[0];
				var filter = {
					url: $.getModule('edit'),
					oid: selectedRow.id,
					mode: 2
				}
				$.openIframe(filter, "订单详情", ['1000px', '582px']);
			}

			//发货
			ns.deliverGoods = function() {
				if(!grid.isSelected()) {
					return false;
				}
				var selectedRow = grid.getSelectedRows()[0];
				var filter = {
					url: "modules/order/list/deliver",
					oid: selectedRow.id,
					mode: 2
				}
				$.openIframe(filter, "订单发货", ['600px', '480px']);
			}
			
			//退款详情
			ns.refundDetails = function() {
				if(!grid.isSelected()) {
					return false;
				}
				var selectedRow = grid.getSelectedRows()[0];
				var filter = {
					url: "modules/order/list/refundDetails",
					oid: selectedRow.id,
					mode: 2
				}
				$.openIframe(filter, "退款详情", ['600px', '480px']);
			}
		  
		    //删除
		    ns.del =function(){
		    	if(!grid.isSelected()){
		    		return false;
		    	}
                grid.setValue('is_system_del',1);
		    }
		    
		    return ns;
		}({}));
		
	</script>
</block>